#include"UdpServer.hpp"
#include<memory>
#include<string>
#include <stdio.h>
#include<vector>
#include"Comm.hpp"
using namespace std;


void Usage(string proc)
{
    cout << "Usag : \n\t" << proc << " local_port\n" << endl;
}

string OnMessageDefault(string request)
{
    return request + "[haha,got you!!]";
}


//./udp_sv 8888
int main(int argc,char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        return Usage_Err;
    }

    // string ip = argv[1];
    uint16_t port = stoi(argv[1]);

    unique_ptr<UdpServer> usvr = make_unique<UdpServer>(OnMessageDefault,port);
    
    usvr->Init();
    usvr->Start();

    return 0;
}
